<?php
/**
 * CMasterLayout class file.
 *
 * @author Lucas Vasconcelos <contato@lucasvasconcelos.com>
 * @copyright Copyright(c) 2010 Lucas Vasconcelos
 * @license BSD License http://www.lucasvasconcelos.com/yap/license
 * @link http://www.lucasvasconcelos.com/yap/
 * @version $Id: CMasterLayout.php 19 2010-02-08 14:52:38Z contato@lucasvasconcelos.com $
 * @package yap.layout
 */

/**
 * CMasterLayout class.
 *
 * @author Lucas Vasconcelos <contato@lucasvasconcelos.com>
 * @version 1.0 $Revision: 19 $
 * @package yap.layout
 */
class CMasterLayout extends TTemplateControl
{
	/**
	 * Call setupTitle() to configure page title.
	 */
	public function onLoad($param)
	{
		parent::onLoad($param);
		Prado::trace('CMasterLayout setupTitle()','yap.layouts');
		$this->setupTitle();
	}

	public function logout($sender,$param)
	{
		$this->Application->getModule('auth')->logout();
		$this->Page->reload();
	}
	
	/**
	 * Setup the page title.
	 */
	protected function setupTitle()
	{
		$page_title=Prado::getApplication()->Parameters['AppName'];
		if($this->getPage()->getTitle())
			$this->getPage()->setTitle($this->getPage()->getTitle() . ' &mdash; ' . $page_title);
		else
			$this->getPage()->setTitle($page_title);
	}
}